package com.src;


import android.app.ListActivity;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;


public class scroll extends ListActivity {
	private static final String[] webpages = {"Android", "Google", "TOI", "Rediff", "Gmail"};
	@Override
	protected void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
			setContentView(R.layout.main);
			ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_checked,webpages);
			setListAdapter(adapter);
			ListView lv = getListView();
			lv.setTextFilterEnabled(true);
			
			lv.setOnItemClickListener(new AdapterView.OnItemClickListener()
			{
				public void onItemClick(AdapterView<?> arg0, View arg1,	int arg2, long arg3) {
				switch(arg2) {
					case 0: //opens Android page
						startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.android.com/")));
					break;
					case 1: //opens google page
						startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com/")));
					break;
					case 2: //opens TOI page
						startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.timesofindia.com/")));
					break;
					case 3: //opens rediff page
						startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.rediff.com/")));
					break;
					case 4: //opens gmail page
						startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.gmail.com/")));
					break;
					default: break;
				}
			}
		});
	}
}